using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyAnimatorTrigger : MonoBehaviour
{
    private Enemy enemy => GetComponentInParent<Enemy>();
    public void AnimatorTrigger()
    {
        enemy.AnimatorIsTrigger();
    }
    private void AttackTrigger()
    {
        AudioManager.Instance.PlayClip(2,enemy.transform);
        Collider2D[] collider2DArray = Physics2D.OverlapCircleAll(enemy.attackCheck.position, enemy.attackRadius);
        foreach (var collider in collider2DArray)
        {
            if (collider.GetComponent<Player>() != null)
            {
                PlayerStat player = collider.GetComponent<PlayerStat>();
                enemy.stat.DoDamage(player);
            }
        }
    }
    private void OpenCounterWindow() => enemy.OpenCounterAttackWindow();
    private void CloseCounterWindow() => enemy.CloseCounterAttackWindow();
}
